跳到主要内容

GetElement

Returns an element by its position in the document.

Syntax

expression.GetElement(nPos);

expression - A variable that represents a ApiDocument class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nPosRequirednumberThe element position that will be taken from the document.

Returns

DocumentElement

Example

This example shows how to get an element by its position in the document content.

let doc = Api.GetDocument();
let section = doc.GetFinalSection();
let docContent = section.GetHeader("default", true);
let paragraph = docContent.GetElement(0);
paragraph.AddText("This is the text in the default header");